# 容器
import uvicorn
# FASTAPI模板
from fastapi import FastAPI
# 配置跨域
from starlette.middleware.cors import CORSMiddleware
# 返回json格式的数据
from fastapi.encoders import jsonable_encoder
import stu

## 声明fastapi的实例
app = FastAPI()
## 跨域配置
origins = ["*"]
app.add_middleware(
    CORSMiddleware, 
    allow_origins=origins,  
    allow_credentials=True,
    allow_methods=["*"], 
    allow_headers=["*"])  

## 注册api模块
app.include_router(stu.router,prefix="/stu")
## 配置容器启动相应的实例
if __name__ == '__main__':
    uvicorn.run( app='main:app',port=10086,reload=True)